package test;
public class IndexedCollection <T extends Named>    
{
  public IndexedCollection (int capacity){

      byIndexes=new T[capacity];
      byNames=new java.util.TreeMap<java.lang.String,T>();
          }
  public @java.lang.Operator(value="[]")T get(int i)
    {
      return byIndexes[i];
    }
    
  public @java.lang.Operator(value="[]")T get(java.lang.String name)
    {
      return byNames.get(name);
    }
    
  public @java.lang.Operator(value="[]=")void set(int i,T t)
    {
      byIndexes[i]=t;
      byNames.put(t.getName(),t);
    }
    
  private T[] byIndexes;
  private java.util.Map<java.lang.String,T> byNames;
  
}

